//package com.amumu.drama.admin.modules.bak;
//
//import com.amumu.drama.common.api.CommonPage;
//import com.amumu.drama.common.api.CommonResult;
//import com.amumu.drama.admin.dto.PmsProductCategoryParam;
//import com.amumu.drama.common.modules.admin.dto.PmsProductCategoryWithChildrenItem;
//import com.amumu.drama.model.PmsProductCategory;
//import com.amumu.drama.admin.modules.game.service.AdminPmsProductCategoryService;
//import io.swagger.annotations.Api;
//import io.swagger.annotations.ApiOperation;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.stereotype.Controller;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
//import java.util.List;
//
///**
// * 商品分类管理Controller
// * Created by macro on 2018/4/26.
// */
//@Controller
//@Api(tags = "PmsProductCategoryController")
//@Tag(name = "PmsProductCategoryController", description = "商品分类管理")
//@RequestMapping("/productCategory")
//public class PmsProductCategoryController {
//    @Autowired
//    private AdminPmsProductCategoryService adminPmsProductCategoryService;
//
//    @ApiOperation("添加商品分类")
//    @RequestMapping(value = "/create", method = RequestMethod.POST)
//    @ResponseBody
//    public CommonResult create(@Validated @RequestBody PmsProductCategoryParam productCategoryParam) {
//        int count = adminPmsProductCategoryService.create(productCategoryParam);
//        if (count > 0) {
//            return CommonResult.success(count);
//        } else {
//            return CommonResult.failed();
//        }
//    }
//
//    @ApiOperation("修改商品分类")
//    @RequestMapping(value = "/update/{id}", method = RequestMethod.POST)
//    @ResponseBody
//    public CommonResult update(@PathVariable Long id,
//                         @Validated
//                         @RequestBody PmsProductCategoryParam productCategoryParam) {
//        int count = adminPmsProductCategoryService.update(id, productCategoryParam);
//        if (count > 0) {
//            return CommonResult.success(count);
//        } else {
//            return CommonResult.failed();
//        }
//    }
//
//    @ApiOperation("分页查询商品分类")
//    @RequestMapping(value = "/list/{parentId}", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<CommonPage<PmsProductCategory>> getList(@PathVariable Long parentId,
//                                                                @RequestParam(value = "pageSize", defaultValue = "5") Integer pageSize,
//                                                                @RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum) {
//        List<PmsProductCategory> productCategoryList = adminPmsProductCategoryService.getList(parentId, pageSize, pageNum);
//        return CommonResult.success(CommonPage.restPage(productCategoryList));
//    }
//
//    @ApiOperation("根据id获取商品分类")
//    @RequestMapping(value = "/{id}", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<PmsProductCategory> getItem(@PathVariable Long id) {
//        PmsProductCategory productCategory = adminPmsProductCategoryService.getItem(id);
//        return CommonResult.success(productCategory);
//    }
//
//    @ApiOperation("删除商品分类")
//    @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
//    @ResponseBody
//    public CommonResult delete(@PathVariable Long id) {
//        int count = adminPmsProductCategoryService.delete(id);
//        if (count > 0) {
//            return CommonResult.success(count);
//        } else {
//            return CommonResult.failed();
//        }
//    }
//
//    @ApiOperation("修改导航栏显示状态")
//    @RequestMapping(value = "/update/navStatus", method = RequestMethod.POST)
//    @ResponseBody
//    public CommonResult updateNavStatus(@RequestParam("ids") List<Long> ids, @RequestParam("navStatus") Integer navStatus) {
//        int count = adminPmsProductCategoryService.updateNavStatus(ids, navStatus);
//        if (count > 0) {
//            return CommonResult.success(count);
//        } else {
//            return CommonResult.failed();
//        }
//    }
//
//    @ApiOperation("修改显示状态")
//    @RequestMapping(value = "/update/showStatus", method = RequestMethod.POST)
//    @ResponseBody
//    public CommonResult updateShowStatus(@RequestParam("ids") List<Long> ids, @RequestParam("showStatus") Integer showStatus) {
//        int count = adminPmsProductCategoryService.updateShowStatus(ids, showStatus);
//        if (count > 0) {
//            return CommonResult.success(count);
//        } else {
//            return CommonResult.failed();
//        }
//    }
//
//    @ApiOperation("查询所有一级分类及子分类")
//    @RequestMapping(value = "/list/withChildren", method = RequestMethod.GET)
//    @ResponseBody
//    public CommonResult<List<PmsProductCategoryWithChildrenItem>> listWithChildren() {
//        List<PmsProductCategoryWithChildrenItem> list = adminPmsProductCategoryService.listWithChildren();
//        return CommonResult.success(list);
//    }
//}
